The invention relates generally to software design and, more particularly, to a system and method for automatically modifying source code for performing the operations of marshaling, unmarshaling and marking modified data objects in a fault-tolerant system or in a distributed system.
Distributed systems based on multiple inexpensive computers (xe2x80x9cprocessorsxe2x80x9d) interconnected by a communication network, such as a Totem System or other Virtual Synchrony system, have many applications. The overall performance of distributed systems may be comparable to more expensive systems, so long as the application may be distributed among many processors.
To provide a distributed system with fault tolerance, information in one processor must be replicated in other processors. Such replication requires information to be transferred between processors. It is also important that such information remain consistent between the processors.
Fault-tolerant systems, whether or not a distributed system, requires that information (xe2x80x9cdata objectsxe2x80x9d) in a primary processor be transferred to a standby processor. In a real-time system, when the primary processor fails, the standby processor should be able to take over all the operations of the primary processor without delay until the primary processor is restored to resume its function as the primary processor.
In distributed systems and fault-tolerant systems, communication of data objects between processors is crucial to the overall performance and reliability of such systems. To transfer data objects, however, data objects must first be marshaled (i.e., converted into a form that may be transmitted over a network) before being transmitted through the network, and then be unmarshaled (i.e., converted from the network form back into data objects) after being received. Also, it is preferable for the sake of efficiency to track and mark data objects which have been modified, and to only transmit modified objects to other processors to update information. The task of marshaling, unmarshaling, and marking modified data objects may be performed by special hardware equipment installed in such systems. However, such hardware equipment can be costly.
As an alternative to using hardware, data objects may be transmitted between processors by incorporating, into an application program, source code for marshaling, unmarshaling and marking modified data objects. This would require that a programmer write source code for marshaling, unmarshaling and marking modified data objects in each and every application program before compiling the program. Such a task, however, is time-consuming, inefficient, and prone to errors.
In a further alternative to using hardware or source code described above, data description languages, such as CORBA""s Interface Description Language (IDL), may be used to automatically generate code for marshaling and unmarshaling operations. The IDL compiler receives the IDL description of all the objects to be transferred and converts it into an actual programming language description of the objects. This requires that a programmer first describe in IDL all the data objects he or she wishes to transfer. Unless the programmer designs the application in IDL, it is inefficient and time-consuming to describe all the data objects in IDL when the data objects are used in other programming languages, such as C++ or Java. Furthermore, IDL does not mark data objects as xe2x80x9cdirtyxe2x80x9d (i.e., modified, but generally excluding transient modifications) when they are modified since it cannot deal with the actual target language.
Accordingly, it would be beneficial to develop a more efficient and reliable method and/or a system for automatically modifying source code for marshaling, unmarshaling, and marking modified data objects.
The present invention accordingly provides a method and system which automatically modify source code to be readily operable in a fault-tolerant system or a distributed system for marshaling, unmarshaling and marking modified data objects. In a method for automatically modifying source code operable in a computer network having two or more interconnected processors, source code of an application is first loaded into storage memory of a computer. The source code is then modified to marshal data objects associated with the application into a buffer, and to unmarshal the marshaled data objects from the buffer. The source code may optionally also be analyzed to identify lines of code that modify data objects, and mark modified data objects in the appropriate places in the code.
A technical advantage of the present invention includes enhancing the efficiency in designing applications running in a distributed system or a fault-tolerant system. Such an advantage is a result of automating the otherwise time-consuming process of writing additional lines of code for marshaling, unmarshaling and marking modified data objects in each and every application developed. Accordingly, coding applications for a fault-tolerant or distributed system is significantly streamlined, thus reducing the time required to introduce a new product to the market. Also, such applications are less prone to errors due to the automation of adding lines of code.